<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="../js/vue.min.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="app">
			<my-component></my-component>
			<my-component></my-component>
			<my-component></my-component>
			<my-component></my-component>
			<my-component>
				<h1 slot="footer">你好</h1>
			</my-component>
		</div>
		
		
		<!-- 组件模板--template标签 -->
		<template id="item">
			<div>
				<button type="button" @click="num++">加</button>
				<p>{{num}}</p>			
				<button @click="num<=1?'':num--">减</button>
				<slot name="footer"></slot>
			</div>
		</template>
		
		
		
		
		<script type="text/javascript">
			
			// 引用模板
			var tem = {
				template:"#item",
				data(){
					return {
						num:1
					}
				}
			}
			
			
			var vm = new Vue({
				el:"#app",
				components:{
					myComponent:tem,
				}
			})
			
			
		</script>
	</body>
</html>
